package org.longteng.mobileluck;


import lombok.extern.slf4j.Slf4j;
import org.longteng.core.utils.PUtil;
import org.longteng.sys.ComputerInfoUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

/**
 * 车牌号AI辅助选号吉祥服务/手机号测试吉祥服务应用springboot启动 (exclude= DataSourceAutoConfiguration.class)
 * @author Hymn
 * @date 2022/12/02
 */
@Slf4j
@SpringBootApplication(exclude= DataSourceAutoConfiguration.class)
@EnableCaching
// @EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
public class MobileLuckStartApp {

    public static void main( String[] args ) {

        ConfigurableApplicationContext context = SpringApplication.run(MobileLuckStartApp.class, args);
        Environment environment = context.getBean(Environment.class);
        String ip = ComputerInfoUtil.getIpAddr() ;
        String port = environment.getProperty("server.port");
        String ansiEnabled = environment.getProperty("spring.output.ansi.enabled");

        String luck = "NEVER".equalsIgnoreCase(ansiEnabled) ? "MobileLuck"
                : PUtil.getColoredStr(32,2,"MobileLuck");
        log.info("start success.\n 车牌号AI辅助选号吉祥服务『"+luck+"』启动成功，后端服务API地址：http://{}:{}/ "
                ,  ip, port);

    }


}
